﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace supermarket.method
{
    internal class Classgiftin
    {
        SqlConnection con = new SqlConnection();
        SqlCommand cmd = new SqlCommand();
        SqlDataReader qlddr = null;  //数据缓冲区

        #region///礼品入库
        public int giftin(string sn,string num)
        {
            int i = 0;
            try
            {
                string s;
                Classgetsql sqlcon = new Classgetsql();
                con = sqlcon.getcon();  //数据库已连接并打开
                                        //2.执行SQL语句（select）
                s = "update Table_gift set number=number+'" + num + "' where giftname ='" + sn + "'";
                cmd = new SqlCommand(s, con);
                i = cmd.ExecuteNonQuery();      //受影响的行数
                return i;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return i = -2;
            }
        }
        #endregion
    }
}
